#!/sbin/openrc-run
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

depend() {
	need modules
	use alsasound
	provide entropy
}

start() {
	local params=""
	[ -n "$DEVICE" ] && params="$params -d $DEVICE"
	[ -n "$SAMPLERATE" ] && params="$params -N $SAMPLERATE"

	ebegin "Starting audio entropy gathering daemon"
	start-stop-daemon --start --quiet --pidfile /var/run/audio-entropyd.pid \
		--exec /usr/sbin/audio-entropyd -- ${params}
	eend ${?}
}

stop() {
	ebegin "Stopping audio entropy gathering daemon"
	start-stop-daemon --stop --quiet --pidfile /var/run/audio-entropyd.pid
	eend ${?}
}
